<?php
// +----------------------------------------------------------------------
// | KyxsCMS [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018~2019 http://www.kyxscms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: kyxscms
// +----------------------------------------------------------------------

namespace app\common\taglib;
use think\template\TagLib;

class ZanPian extends TagLib{
    protected $tags   =  [
	    'list'=> ['attr'=>'cid,sid,pid,start,limit,page,field,cachename,cachetime'],
		'mcat'=> ['attr'=>'cid'],
        'link'=> ['attr'=>'order,type,start,limit,field,cachename,cachetime'],
		'slide'=> ['attr'=>'order,cid,start,limit,field,cachename,cachetime'],
		'special'=> ['attr'=>'order,letter,ids,not,cid,stars,hits,name,wd,tag,prty,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'story'=> ['attr'=>'order,ids,not,vid,vnot,cid,vcid,stars,vstars,hits,vhits,name,wd,prty,vprty,gold,vgold,golder,vgolder,up,vup,down,vdown,addtime,vaddtime,start,limit,page,field,cachename,cachetime'],
        'vod'=> ['attr'=>'order,ids,not,cid,name,likename,mcid,filmtime,play,title,aliases,wd,tag,actor,director,tv,week,isend,isfilm,tj,letter,area,language,year,prty,stars,hits,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'star'=> ['attr'=>'order,ids,not,cid,name,likename,wd,tag,letter,prty,area,zy,xb,sex,guanxi,stars,hits,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
        'news'=> ['attr'=>'order,ids,not,cid,name,likename,topic,topicsid,wd,tag,letter,prty,stars,hits,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'actor'=> ['attr'=>'order,ids,not,vid,vnot,cid,vcid,stars,vstars,hits,vhits,name,wd,prty,vprty,gold,vgold,golder,vgolder,up,vup,down,vdown,addtime,vaddtime,start,limit,page,field,cachename,cachetime'],
	    'role'=> ['attr'=>'order,ids,not,vid,vnot,cid,vcid,stars,vstars,hits,vhits,name,wd,prty,vprty,gold,vgold,golder,vgolder,up,vup,down,vdown,addtime,vaddtime,start,limit,page,field,uid,cachename,cachetime'],
		'part'=> ['attr'=>'order,ids,not,vid,sid,vnot,cid,vcid,stars,vstars,hits,vhits,name,wd,prty,vprty,gold,vgold,golder,vgolder,up,vup,down,vdown,addtime,uptime,vaddtime,start,limit,page,field,uid,cachename,cachetime'],
		'tv'=> ['attr'=>'order,letter,ids,not,cid,stars,hits,name,likename,wd,tag,prty,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'week'=> ['attr'=>'data,live'],
		'topic'=> ['attr'=>'order,tid,sid,did,tsid,stars,hits,name,wd,tag,prty,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'lines'=> ['attr'=>'order,uid,vid,role,hits,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'music'=> ['attr'=>'order,uid,vid,hits,gold,golder,up,down,addtime,start,limit,page,field,cachename,cachetime'],
		'vodtv'=> ['attr'=>'order,tv,name,aliases,id,limit,cachename,cachetime'],
		'gb'=> ['attr'=>'order,uid,cid,vid,status,start,limit,page'],
		'cm'=> ['attr'=>'order,uid,pid,vid,status,start,limit,page'],
		'user'=> ['attr'=>'order,ids,uid,score,login,addtime,start,limit,page,field,cachename,cachetime'],
		'visitors'=> ['attr'=>'order,ids,uid,start,limit,page,field,cachename,cachetime'],
		'remind'=> ['attr'=>'order,ids,uid,cid,start,limit,page,field,cachename,cachetime'],
		'favorite'=> ['attr'=>'order,ids,uid,cid,start,limit,page,field,cachename,cachetime'],
		'playlog'=> ['attr'=>'order,uid,vid,start,limit,page,field,cachename,cachetime'],
		'score'=> ['attr'=>'order,uid,start,limit,page,field,cachename,cachetime'],
		'orders'=> ['attr'=>'order,uid,start,limit,page,field,cachename,cachetime'],
		'msg'=> ['attr'=>'order,uid,start,limit,page,field,cachename,cachetime'],
	];
    public function tagList($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Channel")->listData($__TAG__);';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
        }else{
		$parse .= $content;	
		}		
        return $parse;
    }
    public function tagMcat($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Mcat")->listData($__TAG__);';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
        }else{
		$parse .= $content;	
		}		
        return $parse;
    }	
	
    public function tagLink($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Link")->listData($__TAG__);';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
        }else{
		$parse .= $content;	
		}		
        return $parse;
    }
    public function tagSlide($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Slide")->listData($__TAG__);';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
        }else{
		$parse .= $content;	
		}		
        return $parse;
    }
    public function tagSpecial($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Special")->listData($__TAG__);';
		if(!empty($tag['page'])){
            $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }
    public function tagStory($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Story")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }
    public function tagPart($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Part")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }	
    public function tagVod($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Vod")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
        if(empty($tag['var'])){		
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
    public function tagStar($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Star")->listData($__TAG__);';
		if(!empty($tag['page'])){
           $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
    public function tagNews($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("News")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
    public function tagActor($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Actor")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
    public function tagRole($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Role")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }
    public function tagTv($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Tv")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }
    public function tagWeek($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Tv")->week(\''.$tag['name'].'\',\''.$tag['data'].'\');';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }
    public function tagVodtv($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Tv")->vodtv($__TAG__);';
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}		
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
		
        return $parse;
    }	
    public function tagTopic($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Topic")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }	
    public function tagLines($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Lines")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }	
    public function tagMusic($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Music")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
    public function tagGb($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Gb")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagCm($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Cm")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagUser($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("User")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagVisitors($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("Visitors")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagRemind($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("remind")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagFavorite($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("favorite")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagPlaylog($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("playlog")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagScore($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("score")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagOrders($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("orders")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }
   public function tagMsg($tag,$content){
        if(empty($tag['id'])){
            $tag['id'] = 'zanpian';
        }
        if(empty($tag['key'])){
            $tag['key'] = 'key';
        }
        $parse = '<?php ';
        $parse .= '$__TAG__ = \'' . json_encode($tag) . '\';';
        $parse .= '$__LIST__ = model("msg")->listData($__TAG__);';
		if(!empty($tag['page'])){
        $parse .= '$list_page= $__LIST__;';	
		}
		if(!empty($tag['var'])){
			$parse .= '$' . $tag['var'] . '= $__LIST__;';
		}			
        $parse .= ' ?>';
		if(empty($tag['var'])){
        $parse .= '{volist name="__LIST__" id="'.$tag['id'].'" key="'.$tag['key'].'"';
        if(!empty($tag['offset'])){
            $parse .= ' offset="'.$tag['offset'].'"';
        }
        if(!empty($tag['length'])){
            $parse .= ' length="'.$tag['length'].'"';
        }
        if(!empty($tag['mod'])){
            $parse .= ' mod="'.$tag['mod'].'"';
        }
        if(!empty($tag['empty'])){
            $parse .= ' empty="'.$tag['empty'].'"';
        }
        $parse .= '}';
        $parse .= $content;
        $parse .= '{/volist}';
		}else{
		$parse .= $content;	
		}
        return $parse;
    }	
}